package com.jeedroid.action;

import com.jeedroid.model.User;
import com.jeedroid.serviceImpl.UserServiceImpl;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class LoginAction extends ActionSupport implements ModelDriven<User>
{
private User user=new User();
private UserServiceImpl userServiceImpl;

	public void setUserServiceImpl(UserServiceImpl userServiceImpl)
{
	this.userServiceImpl = userServiceImpl;
}

	@Override
	public String execute() throws Exception
	{
		if(userServiceImpl.checkUserName(user))
		{
			return ActionSupport.SUCCESS;
		}
		else
		{
			return ActionSupport.INPUT;
		}
	}

	@Override
	public User getModel()
	{
		return user;
	}

}
